package cn.jiyun.controller;

import cn.jiyun.pojo.*;
import cn.jiyun.service.TeshuDateService;
import cn.jiyun.vo.ResultCommon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/tes")
@CrossOrigin
public class TeshuDateController {
    @Autowired
    private TeshuDateService teshuDateService;

    @GetMapping("/findAll")
    public ResultCommon findAll() {
        List<TeshuDate> teshuDateList = teshuDateService.findAll();
        return ResultCommon.suceessData(teshuDateList);
    }

    @GetMapping("/deletebyid")
    public ResultCommon deletebyid(Integer id) {
        teshuDateService.deletebyid(id);
        return ResultCommon.suceess();
    }

    @PostMapping("/add")
    public ResultCommon add(@RequestBody TeshuDate teshuDate) {
        teshuDateService.add(teshuDate);
        return ResultCommon.suceess();
    }

    @PostMapping("/updatebyid")
    public ResultCommon updatebyid(@RequestBody TeshuDate teshuDate) {
        teshuDateService.updatebyid(teshuDate);
        return ResultCommon.suceess();
    }
}
